package io.读数据并打印;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Scanner;

public class demo8 {
    public static void main(String[] args) throws FileNotFoundException {
        InputStream inputStream=new FileInputStream("D:\\test.txt");
        //Scanner可以从键盘、文件、网络读取
        //此时scanner就是从文件读取的了
        Scanner scanner=new Scanner(inputStream);//System.in本质上就是一个自己构造的inputStream
        //就可以用scanner读取后续的数据
        String s=scanner.next();
        System.out.println(s);
    }
}
